$(function()
{
	var eiId;
	var tr;
	$(".delete").bind("click",function()
			{
				eiId=$(this).attr("name");//获取要删除的行的id
				//alert(eiId)
				tr=$(this).parent().parent();
				//弹出删除的确定框
				$('#deleteConfirm').dialog('open');
		
			});
	//确定删除的对话框
	$("#deleteConfirm").dialog({
		autoOpen : false,
		/*height :300,*/
		width : 40,
		resizable: false,
		modal : true,
		buttons : {
			'确定' : function()
			{
			var url="/ag/lwc/deletecoverage.action";
			var req={'tbEventInfect.eiId':eiId};
			var ajax=jQuery.post(url,req,function (data)
				{
				if((typeof data.message) == "undefined")
						data = eval("("+data+")");
				//alert(data.message);
				if(data.message=="delete_success")
				{
					//修改表格的内
					$("#message").text("删除成功");
					$('#message').dialog('open');
					tr.remove();
					setTimeout(function(){$('#message').dialog('close');},700); 	
					$("#deleteConfirm").dialog('close');	//关闭确定对话框
				}
				else
				{
					$("#deleteConfirm").dialog('close');		
					$("#message").text("删除失败");
					$('#message').dialog('open');
					//setTimeout(function(){$('#message').dialog('close');},700); 
				}
				});

			},
			'取消' : function() 
			{
				$(this).dialog('close');
			}
		},
		close : function()
		{
			
		}
	});	
	//操作结果的提示框
	$("#message").dialog({
		autoOpen : false,
	/*	height :50,*/
		width : 400,
		resizable: false,
		modal : true,
		buttons : {
		
			'确定' : function() 
			{
				
				$(this).dialog('close');		
				
			}
			
		},
		close : function()
		{
				
		}
	});

});